<template>
  <div>
    <nav class="phone-nav height">
      <i class="iconfont">&#xe669;</i>
      <span class="text">手机号登录</span>
    </nav>
    <div class="inp">
      <input type="password" v-model="inpval" placeholder="请输入密码" @keyup.13="goStep(inpval)">
    </div>
    <div class="btn">
      <button @click="goStep(inpval)" class="label">下一步</button>
    </div>
    <div class="white"></div>
  </div>
</template>
<script>
export default {
  name: 'pwd',
  data () {
    return {
      inpval: null
    }
  },
  methods: {
    goStep (inpval) {
      this.$axios.get(`/api/login/cellphone?phone=${this.$route.params.phone}&password=${this.inpval}`).then((res) => {
        console.log(res.data)
        if (res.data.code === 200) {
          const info = {
            picUrl: res.data.profile.avatarUrl,
            nickname: res.data.profile.nickname,
            token: res.data.token
          }
          localStorage.user = JSON.stringify(info)
          this.$router.push('/')
        }
      })
    }
  },
  mounted () {

  }
}
</script>
<style lang="stylus" scoped>
.white
  height 9.31rem
  width 100%
  background white
.inp
  margin-top 1rem
  padding-bottom: 0.1rem
  display: flex
  align-items: center
  border-bottom 1px solid #ccc
  opacity .5 !important
  .iconguanbi
    font-size .28rem
  input
    height: 16px
    padding: 4px 0px
    font-size: 0.24rem
    margin-left: 10px
    -webkit-box-flex: 1
    border 0
    flex: 1
    caret-color: red
.phone-nav
  display: flex
  align-items: center
.height
  height: 1rem
  line-height: 1rem
  .iconfont
    font-size: 0.7rem
    margin-right: 5px
  .text
    font-size: 0.4rem
    vertical-align: 5px
.btn
  display: flex;
  -webkit-box-pack: center
  justify-content: center
  -webkit-box-align: center
  align-items: center
  text-align: center
  #btn
    position: absolute
    clip: rect(0, 0, 0, 0)
  .label
    box-sizing: border-box
    margin-top: 30px
    padding: 8px
    border-radius: 20px
    line-height: 20px
    width: 80%
    color: #fff
    background: #dd001b
</style>
